

from users.models import User
from django.contrib.auth.models import Group
from meiduo_admin.serializers.admin_serializes import *
from meiduo_admin.custom_paginations import MyPage
from rest_framework.viewsets import ModelViewSet
from rest_framework.generics import ListAPIView


class GroupSimpleView(ListAPIView):
    queryset = Group.objects.all()
    serializer_class = GroupSimpleSerializer


class AdminViewSet(ModelViewSet):
    queryset = User.objects.all()
    serializer_class = AdminModelSerializer
    pagination_class = MyPage

    # 当前视图业务约定处理的是is_staff为True，运营人员
    def get_queryset(self):
        return self.queryset.filter(is_staff=True)












